chart_flag = false;
google.load('visualization', '1', {'packages':['piechart', 'barchart']});
function drawChart() {
	chart_flag = true;
	var data = new google.visualization.DataTable();
	data.addColumn('string', 'Fixer');
	data.addColumn('number', '# of Bugs');
		var chartData = [];
		var idx = 0;
		for(var key in fixerBugs) {
			var num = [key, fixerBugs[key]];
			chartData[idx] = num;
			idx ++
		}
	data.addRows(chartData);

	var piechart = new google.visualization.PieChart(document.getElementById('divPieChart'));
	piechart.draw(data, {width: 400, height: 240, is3D: true, title: '# of Bugs by Fixer'});
	
	var barchart = new google.visualization.BarChart(document.getElementById('divBarChart'));
	barchart.draw(data, {width: 400, height: 240, is3D: true, title: '# of Bugs by Fixer'});
}

function switchChartStyle() {
	switchChartStyleByID('divPieChart');
	switchChartStyleByID('divBarChart');
}

function switchChartStyleByID(id) {
	id = '#'+id;
	if($(id).css('display') == 'none') {
		if(!chart_flag) {
			drawChart();
		}
		$(id).css('display', 'block');
	} else {
		$(id).css('display', 'none');
	}
}
